package com.wjh.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wjh.order.dto.OrderDetailDto;
import com.wjh.order.entity.OrderEntity;
import com.wjh.order.request.QueryOrderPageRequest;

import java.util.List;
import java.util.Map;

/**
 * 订单Mapper
 * 
 * @author wenjianhai
 * @date 2023/6/22
 * @since JDK 17
 */
@Mapper
public interface IOrderMapper {

	void save(OrderEntity order);

	void updatePayState(@Param("orderGuid") String orderGuid, @Param("payState") Integer payState,
			@Param("payMode") Integer payMode);

	OrderEntity queryById(Long id);

	OrderEntity queryByGuid(String orderGuid);

	Page<OrderEntity> page(@Param("req") QueryOrderPageRequest request, @Param("page") Page<OrderEntity> page);

	/**
	 * 查询订单及其详情
	 *
	 * @param orderGuid 订单Guid
	 * @return OrderDetailDto
	 * @date 2023-06-26
	 * @author wenjianhai
	 * @since JDK 17
	 */
	OrderDetailDto queryOrderAndDetails(String orderGuid);

	List<Map<String, Object>> resultMap(Integer payState);
}
